<?php
class PostHomeWidget extends CWidget
{
    public function run()
    {        
    	$category = PostCategory::model()->findByAttributes(array('title'	=>	'posthome'));
    	if(isset($category->posts)):
	    	$posts = $category->posts;
	    	$data['posts'] = $posts;

	        $this->render('posthome',$data);
        else:
			$this->render('posthome');
		endif;
    }
}